package tliasmanagement.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import tliasmanagement.pojo.EmpLog;

@Mapper
public interface EmpLogMapper {

    // 配置事务的传播行为，默认是REQUIRED， REQUIRES_NEW表示当前方法需要开启一个新的事务，无论有无，总是新增一个事务
    @Transactional(propagation = Propagation.REQUIRES_NEW) // 开启事务，有错误数据库回滚，
    @Insert("insert into emp_log (operate_time, info) values (#{operateTime}, #{info})")
    public void insert(EmpLog empLog);

}
